package com.abcdefg.handlerdemo.demo;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//注册拦截器，
@Configuration

public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(loginInterceptor)
//                .addPathPatterns("/**")//设置拦截器拦截的请求路径
//                .excludePathPatterns("/user/login");//设置拦截器排除拦截的请求路径(不会进行拦截)
                                                   // 假设我们需要排除user/login
    }
}
